#include "myglwidget.h"

myGLWidget::myGLWidget(int framesPerSecond, QWidget *parent)
    : QGLWidget(parent)
{
    if(framesPerSecond == 0)
        t_Timer = NULL;
    else
    {
        int seconde = 1000; // 1 seconde = 1000 ms
        int timerInterval = seconde / framesPerSecond;
        t_Timer = new QTimer(this);
        connect(t_Timer, SIGNAL(timeout()), this, SLOT(timeOutSlot()));
        t_Timer->start( timerInterval );
    }

    m_evenement = new Evenement(m_camera);

}


void myGLWidget::timeOutSlot()
{
    updateGL();
}

void myGLWidget::mousePressEvent(QMouseEvent *event)
{
    m_evenement->mousseMove(event);
}

void myGLWidget::mouseReleaseEvent(QMouseEvent *event)
{
    m_evenement->mousseMove(event);
}

void myGLWidget::mouseMoveEvent(QMouseEvent *event)
{
    m_evenement->moussRelease();
}



